#ifndef SIMPLE_SUPPORT_ALGORITHM_ADL_HELPER_HPP
#define SIMPLE_SUPPORT_ALGORITHM_ADL_HELPER_HPP

#include <iterator> // std::begin std::end

#include "traits.hpp" // is_range_v

namespace simple::support
{

	namespace adl_helper
	{
		using std::begin;
		using std::end;

		// TODO: should these return decltype(auto)?
		template <typename Range,
			std::enable_if_t<is_range_v<Range>>* = nullptr>
		constexpr auto adl_begin(Range&& range)
		noexcept(noexcept(begin(std::forward<Range>(range))))
		{
			return begin(std::forward<Range>(range));
		}

		template <typename Range,
			std::enable_if_t<is_range_v<Range>>* = nullptr>
		constexpr auto adl_end(Range&& range)
		noexcept(noexcept(end(std::forward<Range>(range))))
		{
			return end(std::forward<Range>(range));
		}

	} // namespace adl_helper

} // namespace simple::support

#endif /* end of include guard */
